package ch.bfh.abhmcm.SoftwareEngineeringAndDesign.view.passwordcontroll;

import java.awt.BorderLayout;
import java.awt.Dimension;

import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;

import ch.bfh.abhmcm.SoftwareEngineeringAndDesign.model.User;
import ch.bfh.abhmcm.SoftwareEngineeringAndDesign.view.mainframe.Mainframe;
import ch.bfh.abhmcm.SoftwareEngineeringAndDesign.view.passwordcontroll.passwordcontrollSubs.PasswordDialogPanel;

public class Passworddialog extends JDialog {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private PasswordDialogPanel dialogPanel;
	
	public Passworddialog(Mainframe mainframe){
		
		super(mainframe,true);
		
		this.dialogPanel = new PasswordDialogPanel(this);
		
		this.setSize(380, 200);
		this.setLocation(400, 200);		
		this.setResizable(false);
		this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		this.getContentPane().add(new layoutHelper());
		
		this.setVisible(true);
	}
	
	
	
	public User getUser() {
		
		return dialogPanel.getUser();
	}



	private class layoutHelper extends JPanel{
		
		/**
		 * 
		 */
		private static final long serialVersionUID = 1L;

		private layoutHelper(){
			setLayout(new BorderLayout());
			JLabel space = new JLabel();
			space.setPreferredSize(new Dimension(50, 200));
			JLabel space2 = new JLabel();
			space2.setPreferredSize(new Dimension(50, 200));
			
			add(space,BorderLayout.WEST);
			add(dialogPanel);
			add(space2,BorderLayout.EAST);
		}
	}
	
}
